package com.dealglobe.feeder.bvd.query;

import com.bvdep.webservices.ArrayOfSelectionParameter;
import com.bvdep.webservices.SelectionParameter;

public class BvdQueryBuilder {
    private String getDataQuery;
    private String selectionId;
    private ArrayOfSelectionParameter parammeters = new ArrayOfSelectionParameter();
    
    public BvdQueryBuilder selectionId(String selectionId) {
        this.selectionId = selectionId;
        return this;
    }
    
    public BvdQueryBuilder addParammeter(String parammeter, String value) {
        SelectionParameter sp = new  SelectionParameter();
        sp.setParameterId(parammeter);
        sp.setParameterValue(value);
        parammeters.getSelectionParameter().add(sp);
     return this;
    }
    
    public BvdQueryBuilder dataQuery(String resourceName) {
        this.getDataQuery = Utils.readFromResource(resourceName);
        return this;
    }
    
    public BvdQuery build() {
        return new BvdQuery(getDataQuery, selectionId, parammeters);
    }
    
}
